const defaultState = {
	username: "",//登录的用户名
	searchValue: "",//全局搜索内容
	fileAction: "",//标识是文件下载、删除、移动等哪一个操作
	isCheckedAll: false,//文件列表全选或取消全选
	item:{},//文件列表选中项
	isBottom: false,
	changeheadimg: false,//上传头像后其他地方更新头像
}

// const getDetail = (state, action) => {
// 	return state.merge({
// 		title: action.title,
// 		content: action.content
// 	})
// }

export default (state = defaultState, action) => {
	switch(action.type){
		case "USERNAME":
			let newState = {...state};
			newState.username = action.username;
			return newState;
		case "SEARCH":
			let newState1 = {...state};
			newState1.searchValue = action.value;
			return newState1;
		case "FILE_ACTION": return action.fileAction;
		case "CHECKBOX_ALL": 
			let newState3 = {...state};
			newState3.isCheckedAll = action.isCheckedAll;
			return newState3;
		case "JUMP_FILE":
			let newState4 = {...state};
			newState4.item = action.item;
			return newState4;
		case "IS_BOTTOM":
			let newState5 = {...state};
			newState5.isBottom = action.isBottom;
			return newState5;
		case "CHANGE_HEAD_IMG":
			let newState6 = {...state};
			newState6.changeheadimg = action.changeheadimg;
			return newState6;
		default: 
			return state;
	}
}